package io.lkt.modules.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.lkt.commons.dynamic.datasource.annotation.DataSource;
import io.lkt.modules.sys.dao.BVideoCompressionInfoDao;
import io.lkt.modules.sys.entity.BVideoCompressionInfoEntity;
import io.lkt.modules.sys.service.BVideoCompressionInfoService;
import org.springframework.stereotype.Service;

import java.util.Objects;

@Service("bVideoCompressionInfoDao")
public class BVideoCompressionInfoServiceImpl extends ServiceImpl<BVideoCompressionInfoDao, BVideoCompressionInfoEntity> implements BVideoCompressionInfoService {
    @Override
    @DataSource("logdb")
    public int saveEntity(BVideoCompressionInfoEntity entity) {
        return baseMapper.saveEntity(entity);
    }

    @Override
    @DataSource("logdb")
    public boolean check(String videoUrl) {
        boolean result = false;
        BVideoCompressionInfoEntity entity = baseMapper.getEntityByVideoUrl(videoUrl);
        if (!Objects.isNull(entity)) {
            result = true;
        }
        return result;
    }
}
